#include "lua.hpp"

#include <cmath>

extern "C"
{
	static int l_sin(lua_State* L){
		double d = luaL_checknumber(L, 1);
		lua_pushnumber(L, sin(d));
		return 1;
	}
	
	static const luaL_Reg lrLibs[2] = {
		{"sin", l_sin},
		{NULL, NULL}
	};
	
	LUALIB_API int luaopen_mylib(lua_State* L)
	{
		luaL_newlibtable(L, lrLibs);
		luaL_setfuncs(L, lrLibs, 0);
		return 1;
	}
}

